<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="../static/loginstyle.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
    <title>登录</title>
  </head>
  <body>
    <form action="/login" class="login" method="post" onsubmit="encryptPassword()">
      <p>懒羊羊电商网站</p>
      <input type="text" placeholder="用户名" name="username">
      <input type="password" placeholder="密码" name="password">
      <span id="password-error" class="error-message"></span>
      <input type="submit" class="btn" value="登  录">
    </form>
    <script>
      function encryptPassword() {
        const passwordInput = document.getElementsByName("password")[0];
        const encryptedPassword = CryptoJS.MD5(passwordInput.value).toString();
        passwordInput.value = encryptedPassword;
      }
    </script>
  </body>
</html>